package com.chapter.sample.imports;

import com.chapter.sample.beans.OtherBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Map;

public class MyImportSelector implements ImportSelector {
    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {
        //AnnotationMetadata 注解到媒体数据
        Map<String, Object> annotationAttributes = annotationMetadata.getAnnotationAttributes(ComponentScan.class.getName());
        annotationAttributes.forEach((k, v) -> {
            System.out.println(k + ":" + v);
        });

        return new String[]{OtherBean.class.getName()};
    }
}
